// 下拉列表
let $dropList = $('.select-dropdown .dropdown-toggle');
for( let i = 0; i < $dropList.length; i ++ ){
  $dropList.get(i).onclick = function(){
    $('.select-dropdown').removeClass('open');
    $(this).parent().addClass('open');
  };

}

$('.select-dropdown').mouseleave( function(){
  $('.select-dropdown').removeClass('open');
} );

$('.select-dropdown-comp .dropdown-menu li').click(function(e){

  let $parent = $(e.target).parents('.select-dropdown');
  if( $parent.hasClass('select-dropdown-comp') ){
    let sTitle = $(e.target).parents('li').eq(0).attr('data-title');
    let sValue = $(e.target).parents('li').eq(0).attr('data-value');
    $parent.find('.select-label').html(sTitle);
    $parent.find('.select-label').attr('data-value', sValue);
  }

  $('.select-dropdown').removeClass('open');
  return false;

});
